﻿/*
 * 版权属于：yitter(yitter@126.com)
 * 开源地址：https://gitee.com/yitter/idgenerator
 * 版权协议：MIT
 * 版权说明：只要保留本版权，你可以免费使用、修改、分发本代码。
 * 免责条款：任何因为本代码产生的系统、法律、政治、宗教问题，均与版权所有者无关。
 * 
 */

namespace MicroCloud.Utils
{
    #region "Id生成时回调参数"
    /// <summary>
    /// Id生成时回调参数
    /// </summary>
    public class OverCostActionArg
    {
        #region "属性"
        #region "获取或设置 事件类型"
        /// <summary>
        /// 获取或设置 事件类型
        /// 1-开始，2-结束，8-漂移
        /// </summary>
        public virtual int ActionType { get; set; }
        #endregion
        #region "获取或设置 时间戳"
        /// <summary>
        /// 获取或设置 时间戳
        /// </summary>
        public virtual long TimeTick { get; set; }
        #endregion
        #region "获取或设置 机器码"
        /// <summary>
        /// 获取或设置 机器码
        /// </summary>
        public virtual ushort WorkerId { get; set; }
        #endregion
        #region "获取或设置 漂移计算次数"
        /// <summary>
        /// 获取或设置 漂移计算次数
        /// </summary>
        public virtual int OverCostCountInOneTerm { get; set; }
        #endregion
        #region "获取或设置 漂移期间生产ID个数"
        /// <summary>
        ///获取或设置 漂移期间生产ID个数
        /// </summary>
        public virtual int GenCountInOneTerm { get; set; }
        #endregion
        #region "获取或设置 漂移周期"
        /// <summary>
        /// 获取或设置 漂移周期
        /// </summary>
        public virtual int TermIndex { get; set; }
        #endregion

        #endregion

        #region "构造函数"
        #region "初始化一个 Id生成时回调参数 的新实例"
        /// <summary>
        /// 初始化一个 Id生成时回调参数 的新实例
        /// </summary>
        /// <param name="workerId">机器码</param>
        /// <param name="timeTick">时间戳</param>
        /// <param name="actionType">事件类型</param>
        /// <param name="overCostCountInOneTerm">漂移计算次数</param>
        /// <param name="genCountWhenOverCost">GenCountInOneTerm</param>
        /// <param name="index">漂移周期</param>
        public OverCostActionArg(ushort workerId, long timeTick, int actionType = 0, int overCostCountInOneTerm = 0, int genCountWhenOverCost = 0, int index = 0)
        {
            ActionType = actionType;
            TimeTick = timeTick;
            WorkerId = workerId;
            OverCostCountInOneTerm = overCostCountInOneTerm;
            GenCountInOneTerm = genCountWhenOverCost;
            TermIndex = index;
        }
        #endregion

        #endregion

    }
    #endregion

}
